package main

import (
	"flag"
	"fmt"
	"github.com/panjf2000/gnet"
	"log"
	"tcp-proxy/src/config"
	"tcp-proxy/src/net"
)

func main() {

	var multicore, reuseport bool

	// Example command: go run echo.go --multicore=true --reuseport=true
	flag.BoolVar(&multicore, "multicore", true, "--multicore true")
	flag.BoolVar(&reuseport, "reuseport", true, "--reuseport true")
	flag.Parse()
	server := &net.Server{Addr: fmt.Sprintf("tcp://%s:%d", config.GlobalConfig.Server.Host, config.GlobalConfig.Server.Port), Multicore: multicore}
	log.Fatal(gnet.Serve(server, server.Addr, gnet.WithMulticore(multicore), gnet.WithReusePort(reuseport)))

}
